Skip to content

Sync Prettier formatting check CI workflow with template #218

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 11 commits into from
Aug 2, 2021
Merged

Sync Prettier formatting check CI workflow with template #218

merged 11 commits into from
Aug 2, 2021

Conversation

per1234
Copy link
Contributor

@per1234 per1234 commented Aug 1, 2021

We have assembled a collection of reusable GitHub Actions workflows:
https://github.com/arduino/tooling-project-assets
These workflows will be used in the repositories of all Arduino tooling projects.

Some minor improvements and standardizations have been made to the "template" workflow, and these are introduced via this pull request.

@per1234 per1234 added type: enhancement Proposed improvement topic: infrastructure Related to project infrastructure labels Aug 1, 2021
@per1234 per1234 requested review from silvanocerza and umbynos August 1, 2021 07:46
@codecov-commenter
Copy link

codecov-commenter commented Aug 1, 2021

Codecov Report

Merging #218 (db8fc9e) into main (42a40f3) will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##             main     #218   +/-   ##
=======================================
  Coverage   87.97%   87.97%           
=======================================
  Files          43       43           
  Lines        4176     4176           
=======================================
  Hits         3674     3674           
  Misses        391      391           
  Partials      111      111           
Flag Coverage Δ
unit 87.97% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.


Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 29e3108...db8fc9e. Read the comment docs.

per1234 added 11 commits August 2, 2021 01:08
The `config:check-formatting` and `docs:check-formatting` tasks have no value to the developer, since they will be better
off to just run the formatting task. This means that the only use for this task is the CI. I think this can be better
achieved by configuring the CI to format the code and then check for a diff. This ensures that there is no possibility
for a mismatch between the formatting check and the formatting task.
The Prettier formatting tool supports a long list of languages. Previously, it was being arbitrarily limited to JSON,
YAML, and Markdown files. It will be more useful to allow it to format files of any language it supports.
…filter

The workflow should run whenever this file is modified.
…w recursive

`.prettierrc` is the Prettier formatting tool's configuration file. Prettier uses the configuration file closes to the
file being formatted, meaning a project can have multiple configuration files. The workflow should run whenever any
configuration file is edited.
The `workflow_dispatch` event allows triggering the workflow via the GitHub web interface. This makes it easy to trigger
an immediate workflow run after some relevant external change.

The `repository_dispatch` event allows triggering workflows via the GitHub API. This might be useful for triggering an
immediate check in multiple relevant repositories after an external change, or some automated process. Although we don't
have any specific need for this event at the moment, the event has no impact on the workflow, so there is no reason
against having it. It is the sort of thing that can end up being useful if it is already in consistently in place, but
not worth setting up on demand, since the effort to set it up is greater than the effort to trigger all the workflows
manually.
These are the naming conventions established in the standardized template workflow.
… trigger event reference

The workings of the `workflow_dispatch` and `repository_dispatch` events is not obvious from the name. For this reason,
a comment was added to explain their working. But this information is explained well enough in GitHub's documentation, so
the workflow will be less cluttered by simply providing a reference link interested parties can easily follow to get all
the information on the events used by the workflow.
…her YAML file extension

There are two file extensions in common use for YAML files: `.yaml` and `.yml`. Although this project uses `.yml`
exclusively for YAML files, this is a standardized workflow which might be applied to projects that have established the
use of the other extension. It will be most flexible if it supports both.
This is the template workflow filename, which is intended to serve as a unique identifier, and thus must be a bit more
verbose.
The badges provide a prominent indication of the repository's CI status at a glance. This may help to bring potential
issues to the attention of the maintainers.
Prettier formatting is now being applied to all supported files rather than only Markdown and YAML files as previously.
Some files were not compliant.
@per1234 per1234 merged commit f311399 into arduino:main Aug 2, 2021
@per1234 per1234 deleted the check-prettier-formatting branch August 2, 2021 08:28
@per1234 per1234 self-assigned this Nov 20, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic: infrastructure Related to project infrastructure type: enhancement Proposed improvement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants